<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery-3.5.1.js"></script>
    <script src="/js/vue3.2.37.global.js"></script>
    <script src="/js/axios.min.js"></script>
    <script src="/js/layer.js"></script>
</head>
<body>
<div id="app" style="border:1px solid rebeccapurple; margin: 50px auto;text-align: center;margin: 80px auto;padding: 30px">
    <h3>当前网址：http://127.0.0.1:9090</h3>
    <p>
        用户名：<span id="userName">{{userName}}</span>
    </p>

    <p>
        用户描述：<span id="userNameDesc">{{userNameDesc}}</span>
    </p>

    <p>
        {{clientName}}（{{clientHomePageUrl}}）所需权限：<span id="scope">{{scope}}</span>
    </p>

    <p>
        授权模式：<span id="response_type">{{response_type}}</span>
    </p>

    <div>
        <a :href="'/oauth/authorizeCallbackClientUrl?oauthId=' + oauthId"><button>同意授权</button></a>
        <a :href="'/oauth/authorizeCallbackClientUrl?refuseAuthFlag=true&oauthId=' + oauthId"><button style="color: red;margin-left: 20px">拒绝授权</button></a>

    </div>


</div>

</body>
<script>
    function getCookie(cookie_name) {
        var allcookies = document.cookie;
        //索引长度，开始索引的位置
        var cookie_pos = allcookies.indexOf(cookie_name);


        // 如果找到了索引，就代表cookie存在,否则不存在
        if (cookie_pos != -1) {
            // 把cookie_pos放在值的开始，只要给值加1即可
            //计算取cookie值得开始索引，加的1为“=”
            cookie_pos = cookie_pos + cookie_name.length + 1;
            //计算取cookie值得结束索引
            var cookie_end = allcookies.indexOf(";", cookie_pos);


            if (cookie_end == -1) {
                cookie_end = allcookies.length;


            }
            //得到想要的cookie的值
            var value = unescape(allcookies.substring(cookie_pos, cookie_end));
        }
        return value;
    }

</script>

<script>


    const {createApp} = Vue
    const request = axios.create({})
    createApp({
        data() {
            return {
                userName: getCookie("userName"),
                userNameDesc: getCookie("userNameDesc"),
                scope: "${authorizeInfo.scope}",
                clientName: "${thirdSystemInfo.clientName}",
                clientHomePageUrl: "${thirdSystemInfo.clientHomePageUrl}",
                response_type: "${authorizeInfo.response_type}",
                oauthId: "${oauthId}"
            }
        },

        methods: {

        }

    }).mount('#app')

</script>

</html>